<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新增用户</title>
<link href="${rc.getContextPath()}/resources/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/jquery.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/common.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/jquery.validate.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/messages_cn.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/input.js"></script>
 <!-- 引入弹出JS begin -->
<script type="text/javascript" src="${rc.getContextPath()}/js/lhgdialog/lhgdialog.min.js?self=true"></script>
<!-- 引入弹出JS end -->
</head>
<script>
 
jQuery.validator.addMethod("validPassword", function(value, element) { 
 
	if($("#password").val()== value){
		return true;
	}else{
		return false;
	}
 
}, "2次输入的密码不同，请重新输入"); 






$().ready(function() {

	var $inputForm = $("#inputForm");
	
	// 表单验证
	$inputForm.validate({
		errorClass: "fieldError",
		rules: {
			registName: {
				required:true,
				remote: {
                    type: "post",
                    url: "${rc.getContextPath()}/user/admin/ajaxRegistName.html",
                    data: {
                        username: function() {
                            return $("#registName").val();
                        }
                    },
                    dataType: "html",
                    dataFilter: function(data, type) {
                    	eval("var data  = "+data+";");
                        if (data.msg == "true")
                            return "true";
                        else
                            return "存在同名，请重新输入";
                        
                    }
                }
				
			},
			userName: "required",
			password: "required",
			password2: {
				required:true,
				validPassword:true
			
			}
		}
	});
});


function trim(str){ 
	  return str.replace(/^\s+|\s+$/g,''); 
} 
function saveContent(){
 
	 
	$('#inputForm').submit();
}
function back(){
	$.dialog.tips("返回中,请稍等...",600,"loading.gif");
	window.location.href='list.html ';
}
</script>
<body>


<div class="path">
		  <a href="#"> 新增用户</a>
	</div>
	
	<form id="inputForm" action="${base!}/user/admin/saveUser.html" method="post">
 
 
		<!-- 基本功能begin -->
		<table class="input tabContent">
			 
			<tr>
				<th>
					<span class="requiredField">*</span>用户名:
				</th>
				<td >
					 	<input  type="text"  value="" name= "registName" id="registName"/>
				</td>
				
			</tr>

			<tr>
				<th>
					<span class="requiredField">*</span>昵称:
				</th>
				<td >
						<input  type="text"  value="" name= "userName" />
				</td>
				
			</tr>
			
			<tr>
				<th>
					<span class="requiredField">*</span>请输入密码:
				</th>
				<td >
						<input  type="password"  value="" name= "password" id= "password" />
				</td>
				
			</tr>

			<tr>
				<th>
					<span class="requiredField">*</span>请再次输入密码:
				</th>
				<td >
						<input  value="" type="password"  name= "password2"  /> 
				</td>
				
			</tr>
 
</table>
<table class="input">
			<colgroup>
				<col  width="15%"/>
				<col  width="35%"/>
				<col  width="15%"/>
				<col  width="35%"/>
			</colgroup>
			<tr>
				<td>

				</td>
				<td colspan="3">
					<input type="button" class="button" value="保存"  onclick="saveContent()"/>
					<input type="button" id="backButton" class="button" value="返回" onclick="javascript:back()" />
				</td>
			</tr>
		</table> 
</form>

</body>
</html>